<html>
<head>
<!--<LINK href="style/template.php" rel="stylesheet" type="text/css">-->
<LINK href="style/bootstrap.css" rel="stylesheet" type="text/css">
<LINK href="style/tempstrap.css" rel="stylesheet" type="text/css">
</head>
<body>

<?php
require("resources/const.php");
require_once("library/curl.php");

function createPostResponse($content) {
	header("location:/");
}

if (isset($_POST["submit"])) {
    $curl = new curlHelper();
    $curl->addHandle($BACKEND_URL."/api/post/create.php","createPostResponse",
    array("subject"=>$_POST["subject"],"rating"=>$_POST["rating"],"content"=>$_POST["content"],"img"=>$_POST["img"]),true);
    $curl->exec();
}

require("resources/const.php");
require_once("modules/contentWrap.php");
beforeContent();
?>
<form name="createPost" action="" method="post">
<fieldset><legend>Create Post</legend>
<p>
<input type="text"
	name="subject" id="postform_subject" onmousemove="this.focus()"
		placeholder="Subject"
/>
<p>
<input type="text"
	name="img" id="postform_img"
	placeholder="Image (Optional)"
/>
</p>
<p id="postform_contentpara"><textarea placeholder="Content" rows="15" cols="50" style="min-width:60%" type="text" name="content"
	id="postform_content"
></textarea></p>
<select name="rating">
	<option value=1><?php echo $HATELEVEL1?></option>
	<option value=2><?php echo $HATELEVEL2?></option>
	<option value=3><?php echo $HATELEVEL3?></option>
	<option value=4><?php echo $HATELEVEL4?></option>
	<option value=5><?php echo $HATELEVEL5?></option>
</select> <!--<INPUT TYPE="button" NAME="button" Value="Submit" onclick="post(this.form);"/> -->
<!--Do Support for pressing enter to submit and clearing the input fields-->
<input type="submit" name="submit" value="Post" /></fieldset>
</form>
<?php afterContent();?>